$(function(){
    var
        oSpanMoreBank           = $('#spanMoreBank'),
        oMoreBank               = $('#moreBank'),

        oTab_div  =$ ('.tab_div'),
        oTab_button =$('.tab_nav .tab_button');

    oTab_button.click(function(){
        var oBtnIndex = $(this).index();
        oTab_div.css({display:'none'}).eq(oBtnIndex).css({display:'block'});
        oTab_button.removeClass('tab_button_checked').eq(oBtnIndex).addClass('tab_button_checked')
    })
    oSpanMoreBank.click(function(){
        oMoreBank.css({display:'block'})
        oSpanMoreBank.css({display:'none'})
    })



    var
        oSelectbutton  = $ ('.new_address_li .selectbutton'),
        oSelectlist    = $ ('.selectlist'),
        oClose         = $ ('.close'),
        oProvinceText  = $('#provinceText'),
        oCityText      = $('#cityText'),
        oAreaText      = $('#areaText'),
        oSet_1   = $('.set_1 li'),
        oSet_2   = $('.set_2 li'),
        oSet_3    = $('.set_3 li');

    oSelectbutton.click(function(){
        var oSIndex = oSelectbutton.index($(this));
        oSelectlist.css({display:'none'}).eq(oSIndex).css({display:'block'})
    })
    oClose.click(function(){
        var oSIndex = oSelectbutton.index($(this));
        oSelectlist.css({display:'none'})
    })
    oSet_1.click(function(){
        oProvinceText.html($(this).html())
    })
    oSet_2.click(function(){
        oCityText.html($(this).html())
    })
    oSet_3.click(function(){
        oAreaText.html($(this).html())
    })

    var
        sGoods = getCookie('goods'),
        aGoods = JSON.parse(sGoods),
        sUlHtml = '',
        oList_content =$ ('.list_content'),
        oPay= 0,
        iPNUm=0;

    for(var i =0; i < aGoods.length; i++) {
        sUlHtml +='<ul class="list_content_ul"><li class="list_content_left"><p class="list_content_img border_color1"><a href="javascript:;"><img src="'+aGoods[i].goodsSrc+'"> </a></p><p><span class="list_content_name">'+aGoods[i].goodsPinpai+'</span><span>'+aGoods[i].goodsType +'</span><span class="list_content_size"> '+'尺寸：'+aGoods[i].goodSize+'</span></p></li><li>'+'￥'+aGoods[i].goodsPrice+'.00'+'</li> <li class="font14px">'+aGoods[i].goodsNum+'</li><li></li><li>'+ '¥'+aGoods[i].goodsPrice*aGoods[i].goodsNum+'.00'+'</li> </ul> <div class="clear"></div></div>'
        oPay+=aGoods[i].goodsPrice*aGoods[i].goodsNum
        iPNUm=aGoods.length;
    }
    oList_content.prepend(sUlHtml);


    var
        oSettlement_main_right  = $('.settlement_main_right .xiaoji'),
        oTotal_payment          = $('#should_pay_amount');

    oSettlement_main_right.html('￥'+oPay+'.00');
    oTotal_payment.html('￥'+oPay+'.00');

    var
        oNavgoodnumber  = $ ('#nav-shop .good-number a'),
        oNavgoodprice   = $ ('#nav-shop .good-price a');

    oNavgoodnumber.html(iPNUm);
    oNavgoodprice.html('￥'+oPay+'.00')
})